import Vue from 'vue';
import { isLogin } from '@/utils';
import router from '@/router';
export const loadDirective = () => {
  Vue.directive('login', {
    bind: (el, binding) => {
      el.addEventListener('click', (event) => {
        if (!isLogin()) {
          event.stopPropagation();
          router.push("/login");
        } else {
          if (binding.expression) {
            binding.value();
          }
        }
      });
    },
  });
};
